package com.xmh.reptile.service.impl;

import java.util.List;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xmh.reptile.dao.UserDAO;
import com.xmh.reptile.entity.UserEntity;
import com.xmh.reptile.service.UserService;

@Service
public class UserServiceImpl implements UserService {

	@Autowired
	private UserDAO dao;

	private Logger logger = LoggerFactory.getLogger(UserServiceImpl.class);

	@Override
	public Map<String, Object> add(UserEntity user) {
		dao.add(user);
		return successMessages();
	}

	@Override
	public Map<String, Object> delete(UserEntity user) {
		dao.delete(user);
		return successMessages();
	}

	@Override
	public Map<String, Object> update(UserEntity user) {
		dao.update(user);
		return successMessages();
	}

	@Override
	public List<UserEntity> selectList(Map<String, Object> jsonMap) {
		return dao.selectList(jsonMap);
	}

	@Override
	public UserEntity get(UserEntity user) {
		return dao.get(user);
	}

	/**
	 * 返回成功提示
	 * 
	 * @return
	 */
	private Map<String, Object> successMessages() {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("code", "200");
		map.put("msg", "成功");
		return map;
	}

}
